﻿using System;

public enum E_GOAPGoals
{
	E_INVALID = -1,
    E_ORDER_ATTACK,         //命令：攻击
    E_ORDER_DODGE,          //命令：闪避
    E_ORDER_USE,            //命令：使用（某物）
    E_GOTO,                 //前往目标位置
    E_COMBAT_MOVE_LEFT,     //战斗中向左移动
    E_COMBAT_MOVE_RIGHT,    //战斗中向右移动
    E_COMBAT_MOVE_FORWARD,  //战斗中向前移动
    E_COMBAT_MOVE_BACKWARD, //战斗中向后移动
    E_LOOK_AT_TARGET,       //注视目标
    E_KILL_TARGET,          //杀死目标
    E_DODGE,                //闪避
    E_DO_BLOCK,             //格挡
    E_ALERT,                //警戒状态
    E_CALM,                 //恢复平静
    E_USE_WORLD_OBJECT,     //使用场景物体（如开门、拉杆）
    E_PLAY_ANIM,            //播放动画
    E_IDLE_ANIM,            //播放待机动画
    E_REACT_TO_DAMAGE,      //受到伤害时的反应
    E_BOSS_ATTACK,          //Boss攻击指令
    E_TELEPORT,             //传送
    E_COUNT,                //枚举数量（用于计数，无实际指令）
}

class GOAPGoalFactory : System.Object
{
	public static GOAPGoal Create(E_GOAPGoals type, Agent owner)
	{
		GOAPGoal g;
		switch (type)
		{
            case E_GOAPGoals.E_ORDER_ATTACK:
                g = new GOAPGoalOrderAttack(owner);
                break;
            case E_GOAPGoals.E_ORDER_DODGE:
                g = new GOAPGoalOrderDodge(owner);
                break;
            case E_GOAPGoals.E_ORDER_USE:
                g = new GOAPGoalOrderUseWorldObject(owner);
                break;
            case E_GOAPGoals.E_GOTO:
			    g =  new GOAPGoalGoTo(owner);
			    break;
            case E_GOAPGoals.E_COMBAT_MOVE_RIGHT:
                g = new GOAPGoalCombatMoveToRight(owner);
                break;
            case E_GOAPGoals.E_COMBAT_MOVE_LEFT:
                g = new GOAPGoalCombatMoveToLeft(owner);
                break;
            case E_GOAPGoals.E_COMBAT_MOVE_FORWARD:
                g = new GOAPGoalCombatMoveForward(owner);
                break;
            case E_GOAPGoals.E_COMBAT_MOVE_BACKWARD:
                g = new GOAPGoalCombatMoveBackward(owner);
                break;
            case E_GOAPGoals.E_LOOK_AT_TARGET:
                g = new GOAPGoalLookAtTarget(owner);
                break;
            case E_GOAPGoals.E_KILL_TARGET:
			    g = new GOAPGoalKillTarget(owner);
			    break;
            case E_GOAPGoals.E_DODGE:
                g = new GOAPGoalDodge(owner);
                break;
            case E_GOAPGoals.E_DO_BLOCK:
                g = new GOAPGoalDoBlock(owner);
                break;
            case E_GOAPGoals.E_ALERT:
                g = new GOAPGoalAlert(owner);
                break;
            case E_GOAPGoals.E_CALM:
                g = new GOAPGoalCalm(owner);
                break;
            case E_GOAPGoals.E_USE_WORLD_OBJECT:
                g = new GOAPGoalUseWorldObject(owner);
                break;
            case E_GOAPGoals.E_PLAY_ANIM:
                g = new GOAPGoalPlayAnim(owner);
                break;
            case E_GOAPGoals.E_IDLE_ANIM:
                g = new GOAPGoalIdleAction(owner);
                break;
            case E_GOAPGoals.E_REACT_TO_DAMAGE:
                g = new GOAPGoalReactToDamage(owner);
                break;
            case E_GOAPGoals.E_TELEPORT:
                g = new GOAPGoalTeleport(owner);
                break;
            default:
			    return null;
		}

		g.InitGoal();
		return g;
	}
}
